Skip to content

Commit c437025

Browse files
inline calls to getSourceDataLine() in Outlet
1 parent e12f0b3 commit c437025

File tree

1 file changed

+20
-20
lines changed
  • src/main/java/com/goxr3plus/streamplayer/stream

1 file changed

+20
-20
lines changed

src/main/java/com/goxr3plus/streamplayer/stream/Outlet.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void setSourceDataLine(SourceDataLine sourceDataLine) {
6767
* @return true, if successful
6868
*/
6969
public boolean hasControl(final Control.Type control, final Control component) {
70-
return component != null && (getSourceDataLine() != null) && (getSourceDataLine().isControlSupported(control));
70+
return component != null && (sourceDataLine != null) && (sourceDataLine.isControlSupported(control));
7171
}
7272

7373
/**
@@ -95,56 +95,56 @@ void drainStopAndFreeDataLine() {
9595
}
9696

9797
void stopAndFreeDataLine() {
98-
if (getSourceDataLine() != null) {
99-
getSourceDataLine().flush();
100-
getSourceDataLine().close();
98+
if (sourceDataLine != null) {
99+
sourceDataLine.flush();
100+
sourceDataLine.close();
101101
this.sourceDataLine = null; // TODO: Is this necessary? Will it not be garbage collected?
102102
}
103103
}
104104

105105
void flushAndStop() {
106106
// Flush and stop the source data line
107-
if (getSourceDataLine() != null && getSourceDataLine().isRunning()) {
108-
getSourceDataLine().flush();
109-
getSourceDataLine().stop();
107+
if (sourceDataLine != null && sourceDataLine.isRunning()) {
108+
sourceDataLine.flush();
109+
sourceDataLine.stop();
110110
}
111111
}
112112

113113
boolean isStartable() {
114-
return getSourceDataLine() != null && !getSourceDataLine().isRunning();
114+
return sourceDataLine != null && !sourceDataLine.isRunning();
115115
}
116116
void start() {
117-
getSourceDataLine().start();
117+
sourceDataLine.start();
118118
}
119119

120120
void open(AudioFormat audioFormat, int currentLineBufferSize) throws LineUnavailableException {
121121
logger.info("Entered OpenLine()!:\n");
122122

123-
if (getSourceDataLine() != null) {
124-
getSourceDataLine().open(audioFormat, currentLineBufferSize);
123+
if (sourceDataLine != null) {
124+
sourceDataLine.open(audioFormat, currentLineBufferSize);
125125

126126
// opened?
127-
if (getSourceDataLine().isOpen()) {
127+
if (sourceDataLine.isOpen()) {
128128

129129
// Master_Gain Control?
130-
if (getSourceDataLine().isControlSupported(FloatControl.Type.MASTER_GAIN))
131-
setGainControl((FloatControl) getSourceDataLine().getControl(FloatControl.Type.MASTER_GAIN));
130+
if (sourceDataLine.isControlSupported(FloatControl.Type.MASTER_GAIN))
131+
setGainControl((FloatControl) sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN));
132132
else setGainControl(null);
133133

134134
// PanControl?
135-
if (getSourceDataLine().isControlSupported(FloatControl.Type.PAN))
136-
setPanControl((FloatControl) getSourceDataLine().getControl(FloatControl.Type.PAN));
135+
if (sourceDataLine.isControlSupported(FloatControl.Type.PAN))
136+
setPanControl((FloatControl) sourceDataLine.getControl(FloatControl.Type.PAN));
137137
else setPanControl(null);
138138

139139
// Mute?
140-
BooleanControl muteControl1 = getSourceDataLine().isControlSupported(BooleanControl.Type.MUTE)
141-
? (BooleanControl) getSourceDataLine().getControl(BooleanControl.Type.MUTE)
140+
BooleanControl muteControl1 = sourceDataLine.isControlSupported(BooleanControl.Type.MUTE)
141+
? (BooleanControl) sourceDataLine.getControl(BooleanControl.Type.MUTE)
142142
: null;
143143
setMuteControl(muteControl1);
144144

145145
// Speakers Balance?
146-
FloatControl balanceControl = getSourceDataLine().isControlSupported(FloatControl.Type.BALANCE)
147-
? (FloatControl) getSourceDataLine().getControl(FloatControl.Type.BALANCE)
146+
FloatControl balanceControl = sourceDataLine.isControlSupported(FloatControl.Type.BALANCE)
147+
? (FloatControl) sourceDataLine.getControl(FloatControl.Type.BALANCE)
148148
: null;
149149
setBalanceControl(balanceControl);
150150
}

0 commit comments

Comments
 (0)